

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
	int N, B;
	cin >> N >> B;
	vector<int> Height(N);
	for (int i = 0; i < N; i++)
	{
		cin >> Height[i];
	}
	sort(Height.begin(), Height.end(), greater<int>());
	int sum = 0;
	int Count = 0;
	for (int i = 0; i < N; i++)
	{
		sum += Height[i];
		Count++;
		if (sum >= B)
		{
			cout << Count << endl;
			break;
		}
	}
	return 0;
}